#include <filesystem>
#include <vector>
#include <string>
#include <numeric>
#include <thread>
#include <mutex>
using namespace std;
using namespace std::filesystem;
string fileget(string strpath,bool (*boolfunc)(string),vector<string>* strvecptr=nullptr){
    bool firstfind;
    const path folder(strpath);
    vector<string> strvec;
    if(strvecptr ==nullptr){
         firstfind=true;
         strvecptr = &strvec;
    }else{
         firstfind=false;
         strvec = *strvecptr;
    }
    string fileres;
    if(exists(strpath)==false){
         return fileres;
    }
    for(auto const& dir_entry: recursive_directory_iterator{folder})
    {
      string dir_tmp=canonical(dir_entry);
      if(dir_entry.is_directory()==true){
           fileget(dir_tmp,boolfunc,strvecptr);
      }else{
           if(boolfunc(dir_tmp)==true){
                strvec.push_back(dir_tmp);
           }
      }
    }
    if(firstfind == true){
      accumulate(strvec.begin(), strvec.end(), fileres);
    }
    return fileres;
}
